package com.xxxx.protal.controller;

import com.xxxx.api.service.GoodsCategoryExportService;
import com.xxxx.api.vo.GoodsCategoryTree;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author lwf
 * @title: IndexController
 * @projectName shop
 * @description: TODO
 * @date 2021/1/59:36
 */
@Controller
@RequestMapping("/goodsCategory")
public class IndexController {
    @Reference
    private GoodsCategoryExportService categoryExportService;
    @GetMapping("/list")
    @ResponseBody
    public List<GoodsCategoryTree> list(Integer id) throws Exception {
        if(id==null){
            id=0;
        }
        List<GoodsCategoryTree> tree = categoryExportService.getTree(id);
        return tree;
    }
}
